﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

namespace LabMS.Web
{
    public partial class Student : Base.BasePage
    {
        protected int staffIDTemp;
        protected void Page_Load(object sender, EventArgs e)
        {
            strPageUserType.Add("student");
            if (!Page.IsPostBack)
            {
                int ID;
                if (UserID == "")
                {
                    LabMS.Common.JShelper.JSAlertAndRedirect(Page, "script", "用户ID丢失，请重新登录！", "Login.aspx");
                    return;
                }
                if (!int.TryParse(UserID, out ID))
                {
                    LabMS.Common.JShelper.JSAlertAndRedirect(Page, "script", "用户ID存储错误，请重新登录！", "Login.aspx");
                    return;
                }
                staffIDTemp = ID;
            }

        }

        protected int StaffID
        {
            get
            {
                return staffIDTemp;
            }
        }

        //获取StaffID
        //protected int GetStaffIDCodeByUserID(int ID)
        //{
        //    LabMS.BLL.UserTable usertable = new LabMS.BLL.UserTable();
        //    LabMS.Model.UserTable usertableModel = new LabMS.Model.UserTable();
        //    LabMS.BLL.Staff staff = new LabMS.BLL.Staff();
        //    List<LabMS.Model.Staff> staffModelList = new List<LabMS.Model.Staff>();

        //    usertableModel = usertable.GetModel(ID);

        //    staffModelList = staff.GetModelList("Staff_Code='" + usertableModel.PCode + "'");
        //    if (staffModelList.Count > 0)
        //    {
        //        return staffModelList[0].ID;
        //    }
        //    else
        //        return 0;
        //}
    }
}
